package com.vehicle.vo;


import lombok.Data;

@Data
public class ResultVO {
    private Integer code;
    private String msg;
    private Object data;


    public static ResultVO succ(Object data) {
        return succ(200, "成功", data);
    }

    public static ResultVO succ(int code, String msg, Object data) {
        ResultVO r = new ResultVO();
        r.setCode(code);
        r.setData(data);
        r.setMsg(msg);
        return r;
    }

    public static ResultVO succ(String msg, Object data) {
        ResultVO r = new ResultVO();
        r.setCode(200);
        r.setData(data);
        r.setMsg(msg);
        return r;
    }
    public static ResultVO fail(String msg) {
        return fail(500, msg, null);
    }

    public static ResultVO fail(int code, String msg, Object data) {
        ResultVO r = new ResultVO();
        r.setCode(code);
        r.setData(data);
        r.setMsg(msg);
        return r;
    }

    public static ResultVO fail(String msg, Object data) {
        ResultVO r = new ResultVO();
        r.setCode(500);
        r.setData(data);
        r.setMsg(msg);
        return r;
    }

    public static ResultVO fail(int code, String msg) {
        ResultVO r = new ResultVO();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(null);
        return r;
    }

}
